/*
 * Copyright (C) 2013 SeekDeepWithin.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package com.seekdeepwithin.Data;

import com.seekdeepwithin.DataAccess.*;

/**
 * User: Jonathan Montiverdi
 * Date: Sep 26, 2013
 *
 * Represents a link in seek deep within.
 */
public class Link extends BaseDbObject
{
   private int m_Start;
   private int m_End;
   private int m_AreaId;
   private String m_Area;

   /**
    * Initializes a new link.
    * @param id ID of link.
    * @param link Link
    */
   public Link (int id, String link)
   {
      super (id, link);
      this.m_AreaId = 1;
   }

   /**
    * Gets the area of the link.
    * @return Links area.
    */
   public String getArea ()
   {
      return this.m_Area;
   }

   /**
    * Sets the area of the link.
    * @param area Area of link.
    */
   public void setArea (String area)
   {
      this.m_Area = area;
      this.m_AreaId = SdwDatabase.getInstance ().getAreaId (area);
   }

   /**
    * Gets the area ID of the link.
    * @return Links area ID.
    */
   public int getAreaId ()
   {
      return this.m_AreaId;
   }

   /**
    * Gets the start index of the link.
    * @return The links start index.
    */
   public int getStartIndex ()
   {
      return this.m_Start;
   }

   /**
    * Sets the start index of the link.
    * @param startIndex The links start index.
    */
   public void setStartIndex (int startIndex)
   {
      this.m_Start = startIndex;
   }

   /**
    * Gets the end index of the link.
    * @return The links end index.
    */
   public int getEndIndex ()
   {
      return this.m_End;
   }

   /**
    * Sets the end index of the link.
    * @param endIndex The links end index.
    */
   public void setEndIndex (int endIndex)
   {
      this.m_End = endIndex;
   }

   /**
    * Gets the link.
    * @return The links text.
    */
   public String getLink ()
   {
      return this.getName ();
   }
}
